package KK.System
{
	public class ArgumenError
	{
		static public const E_SERIOUS:int=0xFF;
		static public const E_NORMAL:int=0;
		static public const E_NOTICE:int=1;
		static public const E_ARGUMEN:int=2;
		
		
		static protected var Instance:ArgumenError;
		
		
		protected var E_check:int;
		public function ArgumenError(sington:Sington)
		{
			if(ArgumenError.Instance||sington==null)
			{
				throw new Error("ArgumenError is sington class pless using GetInstance function get Instance.");
			}
			ArgumenError.Instance=this;
			this.init();
		}
		private function init():void{
			check=E_NOTICE;
		}
		
		//设置 错误显示 程度
		static public function set check(value:int):void{
			var argumen:ArgumenError=ArgumenError.GetInstance();
			argumen.E_check=value;
		}
		static public function get check():int{
			var argumen:ArgumenError=ArgumenError.GetInstance();
			return argumen.E_check;
		}
		
		static public function checkArgumen(msg:String):void{
			var argumen:ArgumenError=ArgumenError.GetInstance();
			var i:int=0;
			while(1<<i<=ArgumenError.check)
			{
				i=1<<i;
				switch(i)
				{
					case E_NOTICE:
						System.DebugMSG(msg);
						break;
					case E_ARGUMEN:
						throw new Error(msg);
						break;
				}
			}
		}
		
		
		//获取 对象 
		static public function GetInstance():ArgumenError{
			if(!ArgumenError.Instance){
				new ArgumenError(new Sington());
			}
			
			return ArgumenError.Instance;
		}
	}
}

class Sington{
	
}